app.factory("localStorageData",["$window",function($window){
	return {
		//储存单个属性
		set: function(key,value){
			$window.localStorage[key] = value;
		},
		
		//获取单个属性
		get: function(key,defaultValue){
			return $window.localStorage[key] || defaultValue;
		},
		
		//删除存储
		clear: function(key){
			
			$window.localStorage.clear();
			
		},
		
		//删除某一个存储
		removeItem: function(key){
			$window.localStorage.removeItem(key)
		},
		
		//存储对象，以JSON格式存储
        setObj: function(key,value){
        	$window.localStorage[key]=JSON.stringify(value);
        },
        
        //读取对象
        getObj: function (key) {
        	return JSON.parse($window.localStorage[key] || '{}');
        }
	}
}])
